function debug(msg){
    
    var debug=document.getElementById("debug");
    if(!debug){
        debug=document.createElement("div");
        debug.id="debug";
        debug.innerHTML="<h3>debugging</h3>"
        document.body.appendChild(debug);
    }
    var node=document.createElement("pre");
    node.innerText=msg;
    debug.appendChild(node);
}